﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QQTools.Data;

namespace QQTools.Services.Tasks
{
    public abstract class BaseTaskManager<TTask> where TTask : class
    {
        //protected DatabaseContext databaseContext;
        //protected Dictionary<string, TTask> runningTasks = new Dictionary<string, TTask>();

        //public BaseTaskManager(DatabaseContext manager)
        //{
        //    this.databaseContext = manager;
        //}

        /// <summary>
        /// 添加任务到任务列表
        /// </summary>
        public abstract void AddTask(TTask task);

        /// <summary>
        /// 启动任务（支持恢复）
        /// </summary>
        public abstract void StartTask(string taskId);

        /// <summary>
        /// 暂停任务
        /// </summary>
        public abstract void PauseTask(string taskId);

        /// <summary>
        /// 恢复任务
        /// </summary>
        public abstract void ResumeTask(string taskId);

        /// <summary>
        /// 停止任务
        /// </summary>
        public abstract void StopTask(string taskId);

        /// <summary>
        /// 更新UI状态
        /// </summary>
        protected abstract void UpdateUI(TTask task);

        /// <summary>
        /// 执行任务的核心逻辑
        /// </summary>
        protected abstract  Task ExecuteTaskAsync(TTask task);
    }
}
